A sound collection’s “snd ” resources should be small, so as to minimize excessive memory usage. All the sounds are loaded into memory when the file is opened. Sounds that play by looping themselves (see below) should be resource locked. Other sounds should not be resourced locked so the System can move unused sounds when memory fragmentation occurs. The locking status gets preserved when the sounds are moved into “temporary” memory.
Constucting a looped sound will probably require a means of editing a sound resource’s internal information, specifically its command list. A typical sample sound contains a lone “bufferCmd” which simply plays the sound data once all the way through. To make a sound become looped, this needs to be replaced with a “soundCmd” followed by a “freqCmd.” For compatibility with Sound Manager 2.0, it may be necessary to add some “waitCmd’s” after the freqCmd. Consult Inside Macintosh: Sound for more information.
PACE Resource
A ResEdit template for this resource exists in the Ambiance application itself. It consists of three elements. The first two are the minimum and maximum time between two played sounds. The times are in 1/60’s of a second. The interval between sounds is randomly determined based on this range. If the minimum time is greater than the maximum time, Ambiance only plays one sound when the collection is first opened. This is usually used for sound collections that contain a single looped sound. The last element is a toggle for activating sound playback in a sequential order. If toggled off, the sounds are chosen randomly. If toggled on, the sounds are played back in the order the sounds are in the file. This does not correspond to the ID numbers of the sounds. If you want the sounds to be played back by ID, select all of the sounds in ResEdit, cut, and paste. This reorders the sounds by ID instead of how old each sound is in the file.
“Get Info” Alert
When the user chooses “Get Info” from the File menu, Ambiance attempts to load in an “ALRT” resource of number 327. The “alert levels” of this alert should not activate a system beep, and they should all default to the “OK” button. The “DITL” resource should, of course, have its first element be this button. The button should be the only control. I recommend that for any text that you use, you use black and white “PICT” resources that are made with the Times typeface, 12 point for body text and 18 for headers. This is what is used in the About… alert and this documentation. For color elements, using “cicn” resources to allow you to specify different images for B&W and color systems.
The file can also have a “vers” resource for disclosing version and authorship information. Also, the file should be of type “ßfil” and of creator “åµ∫î.”